Mobile robots can be equipped with a distance sensor. Relative positions of the robot and the surrounding environment can be calculated out according to the time difference between a signal transmitted and received, providing the basis of a determination of robot movement. However, when the distance sensor is exposed to water of other liquid false readings and interference signals may happen.